package com.tourManagement.entity;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * @author xiaoRan
 */
@Data
@Slf4j
public class RT {
    private Integer code;
    private String message;
    private Object data;


    private RT() {
    }

    public static RT success() {
        RT r = new RT();
        r.setCode(0);
        r.setMessage("请求成功");
        return r;
    }

    public static RT success(Object data) {
        RT r = new RT();
        r.setCode(0);
        r.setMessage("请求成功");
        r.setData(data);
        return r;
    }

    public static RT error() {
        RT r = new RT();
        r.setCode(-1);
        r.setMessage("请求失败");
        return r;
    }

    public static RT error(String message) {
        RT r = new RT();
        r.setCode(-1);
        r.setMessage(message);
        return r;
    }

    public RT message(String message) {
        this.setMessage(message);
        return this;
    }

    public RT code(Integer code) {
        this.setCode(code);
        return this;
    }

}


